package com.example.hostsys.entity;

import com.example.hostsys.payloads.AddMeetPay;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

@Entity
@Data
@NoArgsConstructor
@JsonIgnoreProperties(value = {"hibernateLazyInitializer","student"})
public class Meeting {
    public Meeting(House house, Student student, AddMeetPay addMeetPay){
        this.house=house;
        this.student=student;
        time=addMeetPay.getDatetime();
        desc=addMeetPay.getDesc();
        noticeHost=true;
        updateTime=new Date();

    }
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    private String location;
    private Date time;
    @Column(name = "description")
    private String desc;
    private Date updateTime;
    private boolean noticeStu;
    private boolean noticeHost;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn
    private Student student;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn
    private House house;
}
